<?php

class Ext_Oauth_Login_Adapter
{
    private static $_adapter;
    
    public function __construct($adapter)
    {
        if(!isset(self::$_adapter))
        {
            $classname = "Ext_Oauth_Login_Adapter_".ucfirst($adapter);
            if(!class_exists( $classname ))
            {
                require_once 'Ext/Oauth/Login/Exception.php';
                  throw new Ext_Oauth_Login_Exception("Oauth adapter '$adapter' is not exists.");
            }
            
            self::$_adapter = new $classname();
        }
    }
    
    public function oauth()
    {
        $_result = self::$_adapter->oauth();
        
        return $_result;
    }
}
